# -*- coding =utf-8 -*-
# @Time : 2022/9/14 15:30
# @Author :1814-09胡海燕
# @File : 3-7.py
# @Software : PyCharm
# 要求让用户输入一段文本，系统按要求判断是低强度密码还是高强度密码
# 密码只能由数字或字母（不分大小写）组成
# 低级密码要求：1. 密码由单纯的数字或字母组成; 2. 或密码长度小于等于8位
# 高级密码要求：1. 密码由数字、字母组合; 2. 并且密码长度高于8位
shuzi = "0123456789"
zimu = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
pwd = input("请输入一段密码：")
length = len(pwd)
# 判断是否为空
while pwd.isspace() or length == 0:
    pwd = input("密码为空，请重新输入：")
    length = len(pwd)
# 判断长度
pwdlength = 0
if length < 8:
    pwdlength = 1
else:
    pwdlength = 2
# 判断密码组合
pwdcon = 0
for i in pwd:
    if i in shuzi:
        pwdcon += 1
for i in pwd:
    if i in zimu:
        pwdcon += 1
# 输出密码等级
while 1:
    print("密码等级为：")
    if pwdlength == 1 or pwdcon == 1:
        print("初级")
    elif pwdlength == 2 and pwdcon == 2:
        print("高级")
    else:
        print("不符合要求！")
